home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dirut / free16.zip / FREE.C < prev    next >
Text File  |  1989-02-17  |  37KB  |  769 lines

  1. /****************************************************************************
  2.  
  3.     FREE   : free.c checks disk free space, with options
  4.  
  5.     Author : Howard S. Kapustein
  6.  
  7.     Program, Source, Documentation Copyright (c) 1988,1989 all rights reserved.
  8.  
  9.     Compiled code may be used in your library, and linked to your programs
  10.     BUT, the source code nor a library based on the compiled modules may be
  11.     commercially distributed.
  12.     I retain all rights to the source (this is all lawyer talk. I just don't
  13.     want someone making money off my efforts.)
  14.     No donation is expected. If you like FREE, send me a picture postcard
  15.     or, if you must, $5. I am a poor starving college student and will
  16.     gladly accept all comments, questions, suggestions and/or donations.
  17.  
  18.     For a quick start try   FREE -?
  19.  
  20.     I know this is a pretty simple program. There are plenty of versions
  21.     of free disk space programs in the public domain, but none suited my 
  22.     needs. I needed 3 features besides the standard disk space free:
  23.  
  24.         1) Check more than 1 drive per run
  25.         2) Optionally check all drives
  26.         3) Optionally wait for a keypress after execution for use
  27.            with DESQview (tm)
  28.  
  29.     FREE.C, FREE.EXE and FREE.DOC must be distributed together.
  30.  
  31.     FREE was compiled with Turbo C (tm) 2.0 on an IBM PC with the Tiny
  32.     memory model optimized on Speed and all optimizations turned on
  33.     (Register and Jump optimization).
  34.  
  35.     Release notes:      2-2-88  Version 1.0 - Initial release
  36.  
  37.                         2-22-88 Version 1.1
  38.                                   - checks for drive ready before checking
  39.                                     free space
  40.                                   - skips drive B: only 1 drive present
  41.                                     (B: is a logical drive, not a physical
  42.                                     drive)
  43.                                   - optional wait after execution can now
  44.                                     wait for a specific key (specify its
  45.                                     decimal scan code, only valid for keys
  46.                                     1-255 (no extended keys i.e. Alt-C, etc.)
  47.                                   - fixed a bug with the strtocomma() function.
  48.                                     If a 4-digit number (i.e. 9216) was passed
  49.                                     to it it would not insert any commas
  50.                                   - I no longer make FREE.COM, for some reason
  51.                                     under DESQview FREE.COM 1.0 still needed
  52.                                     approx 70K, so until I can figure out how
  53.                                     to get FREE to use appropriate only the 11K
  54.                                     or so it needs, I'm not going to bother
  55.                                     playing with COM files
  56.  
  57.                         2-29-88 Version 1.2
  58.                                   - recompiled under Turbo C 1.5 (it only took
  59.                                     them 6 weeks instead of the 2-3 it should
  60.                                     have...) I turned on ALL optimizations
  61.                                     (speed, use regs, optimize regs and jumps.)
  62.                                     Previous versions were only compiled with
  63.                                     speed and use registers.
  64.                                   - modified the parsing for more coherent
  65.                                     program flow
  66.                                   - made waitforkey() after having extensive
  67.                                     difficulties getting the -w option to work.
  68.                                     This seems to have fixed the runtime bugs
  69.                                     I was getting after recompiling with TC 1.5
  70.                                   - changed the HEAP and STACK size so it will
  71.                                     run with less memory
  72.                                   - removed some needless comments left over
  73.                                     from old coding
  74.                                   - include a DESQview .DVP file for use with
  75.                                     DESQview.
  76.  
  77.                         3-19-88 Version 1.3
  78.                                   - fixed the bug with multiple drives
  79.                                     specified on the command line. It seems
  80.                                     that TC 1.5 DOES NOT let you use the
  81.                                     generic argc and argv as in
  82.                                     main(int argc, char *argv[]) Now Borland
  83.                                     wants you to use their global variables
  84.                                     (extern int argc, etc.). Nice of them not
  85.                                     to mention the fact that the old method
  86.                                     no longer works.
  87.  
  88.                         3-23-88 Version 1.31  -  Internal release only
  89.                                   - if you try to do a   FREE -   with no
  90.                                     parms free would check the default drive.
  91.                                     This has been fixed to display the help
  92.                                     (technically, doing   FREE -   is wrong)
  93.                                   - version 1.2 allowed -w[n] option to check
  94.                                     for extended key codes, but I forgot to
  95.                                     document it. Use this formula to get the
  96.                                     value for the wait option:
  97.  
  98.                                         extended * 256 + scancode
  99.  
  100.                                     where extended is 0 if False and 1 if True
  101.                                     and scancode is the scan code returned by
  102.                                     the key (refer to one of Norton's books
  103.                                     or some other reference guide for a list
  104.                                     of IBM extended scan codes.)
  105.  
  106.                         4-10-88 Version 1.32  -  Internal release only
  107.                                   - I removed a printf() left over from
  108.                                     debugging
  109.                                   - included info about contacting me during
  110.                                     the school year
  111.  
  112.                          5-6-88 Version 1.33  - Internal release only
  113.                                   - included % free
  114.  
  115.                         5-11-88 Version 1.34  - Internal release only
  116.                                   - fixed -w option, was skipping past
  117.                                     1st digit of keycode ([n])
  118.                                   - also, discovered the problem with the
  119.                                     -w option. Compiled w/full optimization,
  120.                                     the waitkey value was stored in a
  121.                                     register which was destroyed during the
  122.                                     absread(). This is a problem of the
  123.                                     TC library itself. I don't remember
  124.                                     who it was who discovered this flaw, but
  125.                                     if you drop me a line I'll update these
  126.                                     docs. He has notified Borland, so
  127.                                     hopefully the next TC will have this bug
  128.                                     fixed (if not sooner, but I'm not
  129.                                     holding my breath.) Thank you for the
  130.                                     debugging, it gave me many a restless
  131.                                     hour. DO NOT compile FREE with register
  132.                                     variables on, or unknown results may
  133.                                     (and probably will) occur
  134.  
  135.                         11-9-88 Version 1.4
  136.                                   - recompiled under TC 2.0 in Small model,
  137.                                     Merge duplicate strings On, Standard
  138.                                     stack frame Off, and all Debu